package receiver;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ita.ios.jms.protocol.JmsProtocol;

import po.LowAudit;
import po.MerchantAudit;
import service.LowAuditManager;
import service.MerchantAuditManager;
import vo.MerchantAuditVo;
import vo.OrderComplaintVo;
 
@Component("merchantGradeListener")
public class MerchantGradeListener implements MessageListener {
	
	@Autowired
	private LowAuditManager lowAuditManager;
	
	@Override
	public void onMessage(Message message) {
		try {
			String text = ((TextMessage)message).getText();
		System.out.println("merchantGradeListener接收到消息:" + text);
		LowAudit lowAudit = (LowAudit) JmsProtocol.deserializeObject(text, LowAudit.class);
		if(lowAudit != null){
			lowAuditManager.addLowAudit(lowAudit);
			System.out.println("add the merchantAudit success!!!");
		}
		} catch (JMSException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
